//
//  SINAStuActivityImpressModel.m
//  sinashebao
//
//  Created by  androidlongs on 2018/1/23.
//  Copyright © 2018年  androidlongs. All rights reserved.
//

#import "SINAStuActivityImpressModel.h"

@implementation SINAStuActivityImpressModel
-(instancetype)initWithDict:(NSDictionary *)result{
    if (self=[super init]) {
        //[NSString stringWithFormat:@"%@",result[@"name"]];
        _impressDes=[NSString stringWithFormat:@"%@",result[@"content"]];
        if (_impressDes==nil||_impressDes.length==0||[_impressDes isEqualToString:@"(null)"]) {
            _impressDes=[NSString stringWithFormat:@"%@",result[@"essaycontent"]];
        }
        _impressTime=[NSString stringWithFormat:@"%@",result[@"createtime"]];
        if (_impressTime==nil||_impressTime.length==0||[_impressTime isEqualToString:@"(null)"]) {
            _impressTime=[NSString stringWithFormat:@"%@",result[@"essaycreatetime"]];
        }
        _impressUid=[NSString stringWithFormat:@"%@",result[@"uuid"]];
        if (_impressUid==nil||_impressUid.length==0||[_impressUid isEqualToString:@"(null)"]) {
            _impressUid=[NSString stringWithFormat:@"%@",result[@"essayuuid"]];
        }
        
        _createUserUid=[NSString stringWithFormat:@"%@",result[@"createuuid"]];
        
        NSString *imagepath=[NSString stringWithFormat:@"%@",result[@"imgpath"]];
        if (imagepath==nil||imagepath.length==0||[imagepath isEqualToString:@"(null)"]) {
            NSArray *imageArray =    result[@"imageurls"];
            NSMutableArray *flagArray=[[NSMutableArray alloc]init];
            if (imageArray!=nil&&imageArray.count>0) {
                for (NSInteger i=0; i<imageArray.count; i++) {
                    NSString *url = imageArray[i];
                    [flagArray addObject:url];
                }
            }
            _temaImageArray=flagArray;
            
        }else{
            if (imagepath!=nil&&imagepath.length>0&&![imagepath isEqualToString:@"(null)"]) {
                NSMutableArray *flagArray=[[NSMutableArray alloc]init];
                NSArray *imageArray = [imagepath componentsSeparatedByString:@","];
                for (NSInteger i=0; i<imageArray.count; i++) {
                    NSString *url = imageArray[i];
                    [flagArray addObject:url];
                }
                _temaImageArray=flagArray;
            }
        }
    }
    return self;
}
+(instancetype)userWithDict:(NSDictionary *)dict{
    return [[self alloc] initWithDict:dict];
}
@end
